plugor.draggable = function(elem) {
	mousedown: function(elem, e) {
		if(e.preventDefault) e.preventDefault();
		WebIMWindow.move = true;
		WebIMWindow.pos.left = parseInt(WebIMWindow.div.style.left);
		WebIMWindow.pos.top = parseInt(WebIMWindow.div.style.top);
		
		WebIMWindow.mousePos.x = e.clientX;
		WebIMWindow.mousePos.y = e.clientY;
		
		elem.style.cursor = 'move';
		
		WebIMTools.bind(document, "mousemove", WebIMWindow.mousemove);
		WebIMTools.bind(elem, "mouseup", WebIMWindow.mouseup);
	},
	
	mousemove: function(elem, e) {
		if(e.preventDefault) e.preventDefault();
		if(!WebIMWindow.move) return;
		
		window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
		
		WebIMWindow.div.style.left = WebIMWindow.pos.left + e.clientX - WebIMWindow.mousePos.x + 'px';
		WebIMWindow.div.style.top = WebIMWindow.pos.top + e.clientY - WebIMWindow.mousePos.y + 'px';
	},
	
	mouseup: function(elem, e) {
		WebIMWindow.move = false;
		elem.style.cursor = 'pointer';
		if(e.preventDefault) e.preventDefault();
		
		WebIMTools.unbind(document, "mousemove", WebIMWindow.mousemove);
		WebIMTools.unbind(elem, "mouseup", WebIMWindow.mouseup);
	}
}